<!DOCTYPE html>
<html>
<head>
<title>Weiran ECMAScript Applications Framework</title>
<link rel=stylesheet type=text/css href=./style.css>
</head>

<body>

<div class=leftbar>
    <h1>Weiran</h1>
    <p>ECMAScript<br />Applications Framework</p>
    <p>Version: 1.2</p>
    <ul>
	<li><a href=Weiran.html>Weiran</a></li>
	<li><a href=Weiran.Array.html>Weiran.Array</a></li>
	<li><a href=Weiran.Buffer.html>Weiran.Buffer</a></li>
	<li><a href=Weiran.Class.html>Weiran.Class</a></li>
	<li><a href=Weiran.Date.html>Weiran.Date</a></li>
	<li><a href=Weiran.DB.html>Weiran.DB</a></li>
	<li>Weiran.Event<ul>
	    <li><a href=#Weiran.Event.element>Weiran.Event.element</a></li>
	    <li><a href=#Weiran.Event.isSingleTouch>Weiran.Event.isSingleTouch</a></li>
	    <li><a href=#Weiran.Event.isMultiTouch>Weiran.Event.isMultiTouch</a></li>
	    <li><a href=#Weiran.Event.isLeftClick>Weiran.Event.isLeftClick</a></li>
	    <li><a href=#Weiran.Event.isRightClick>Weiran.Event.isRightClick</a></li>
	    <li><a href=#Weiran.Event.stop>Weiran.Event.stop</a></li>
	    <li><a href=#Weiran.Event.findElement>Weiran.Event.findElement</a></li>
	    <li><a href=#Weiran.Event.observe>Weiran.Event.observe</a></li>
	    <li><a href=#Weiran.Event.stopObserving>Weiran.Event.stopObserving</a></li>
	    <li><a href=#Weiran.Event.stopObservingElement>Weiran.Event.stopObservingElement</a></li>
	    <li><a href=#Weiran.Event.unloadCache>Weiran.Event.unloadCache</a></li>
	</ul></li>
	<li><a href=Weiran.Events.html>Weiran.Events</a></li>
	<li><a href=Weiran.Function.html>Weiran.Function</a></li>
	<li><a href=Weiran.JSON.html>Weiran.JSON</a></li>
	<li><a href=Weiran.Lang.html>Weiran.Lang</a></li>
	<li><a href=Weiran.Number.html>Weiran.Number</a></li>
	<li><a href=Weiran.String.html>Weiran.String</a></li>
	<li><a href=Weiran.GRUB.html>GRUB Mechanism</a></li>
    </ul>
    <p>
        Copyright &copy; All<span>i</span>dylls<br />
        2011 - 2012
    </p>
</div>

<div class=content>

<div class=reftitle>Weiran.Event</div>
<p>Sub namespace contains utility functions for browser event handling.</p>

<a name=Weiran.Event.element></a>
<h3><code>Weiran.Event.element(event)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters: </b><br />
    <span class=parameters>event</span> - <code>object</code>
</p>
<p><b>Returns: </b><code>DOMElement</code></p>
<p>Cross browser event element detection. Returns the element that caused the event.</p>

<a name=Weiran.Event.isSingleTouch></a>
<h3><code>Weiran.Event.isSingleTouch(event)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters: </b><br />
    <span class=parameters>event</span> - <code>object</code>
</p>
<p><b>Returns: </b><code>boolean</code></p>
<p>Determine whether event was caused by a single touch.</p>

<a name=Weiran.Event.isMultiTouch></a>
<h3><code>Weiran.Event.isMultiTouch(event)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters: </b><br />
    <span class=parameters>event</span> - <code>object</code>
</p>
<p><b>Returns: </b><code>boolean</code></p>
<p>Determine whether event was caused by a multi touch.</p>

<a name=Weiran.Event.isLeftClick></a>
<h3><code>Weiran.Event.isLeftClick(event)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters: </b><br />
    <span class=parameters>event</span> - <code>object</code>
</p>
<p><b>Returns: </b><code>boolean</code></p>
<p>Determine whether event was caused by a left mouse click.</p>

<a name=Weiran.Event.isRightClick></a>
<h3><code>Weiran.Event.isRightClick(event)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters: </b><br />
    <span class=parameters>event</span> - <code>object</code>
</p>
<p><b>Returns: </b><code>boolean</code></p>
<p>Determine whether event was caused by a right mouse click.</p>

<a name=Weiran.Event.stop></a>
<h3><code>Weiran.Event.stop(event, default)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters: </b><br />
    <span class=parameters>event</span> - <code>object</code><br />
    <span class=parameters>default</span> - <code>boolean</code>, to allow the default browser behaviour, defaults to false
</p>
<p><b>Returns: </b><code>undefined</code></p>
<p>Stops an event from propagating. If default true, we stop the event chain but still allow the default browser 
     behaviour (text selection, radio-button clicking, etc).</p>

<a name=Weiran.Event.findElement></a>
<h3><code>Weiran.Event.findElement(event, tag)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>event</span> - <code>object</code><br />
    <span class=parameters>tag</span> - <code>string</code>, HTML tag name
</p>
<p><b>Returns: </b><code>DOMElement</code></p>
<p>The first node with the given tag,
    starting from the node the event was triggered on and traversing the DOM upwards.</p>

<a name=Weiran.Event.observe></a>
<h3><code>Weiran.Event.observe(element, name, observer, capture)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>event</span> - <code>DOMElement | string</code>, DOM or DOM id<br />
    <span class=parameters>name</span> - <code>string</code>, event name<br />
    <span class=parameters>observer</span> - <code>function</code>, event handler<br />
    <span class=parameters>capture</span> - <code>boolean</code>, use capture or not, defaults to false
</p>
<p><b>Returns: </b><code>undefined</code></p>
<p>Starts to observe a DOM element with observer.</p>

<a name=Weiran.Event.stopObserving></a>
<h3><code>Weiran.Event.stopObserving(element, name, observer, capture)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>event</span> - <code>DOMElement | string</code>, DOM or DOM id<br />
    <span class=parameters>name</span> - <code>string</code>, event name<br />
    <span class=parameters>observer</span> - <code>function</code>, event handler<br />
    <span class=parameters>capture</span> - <code>boolean</code>, use capture or not, defaults to false
</p>
<p><b>Returns: </b><code>boolean</code></p>
<p>Returns whether or not the event observer was removed.</p>

<a name=Weiran.Event.stopObservingElement></a>
<h3><code>Weiran.Event.stopObservingElement(element)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>event</span> - <code>DOMElement | string</code>, DOM or DOM id
</p>
<p><b>Returns: </b><code>undefined</code></p>
<p>Given the id of an element to stop observing, cycle through the element's cached observers, 
    calling stopObserving on each one, skipping those entries which can no longer be removed.</p>

<a name=Weiran.Event.unloadCache></a>
<h3><code>Weiran.Event.unloadCache()</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b>
</p>
<p><b>Returns: </b><code>undefined</code></p>
<p>Cycle through all the element entries in the events cache and call stopObservingElement on each.</p>
<p>Note, for preventing memory leaks in IE,
    this function will be called on unload event of <code>window</code> by default.</p>

</div>

</body>
</html>
